home *** CD-ROM | disk | FTP | other *** search
- /* curvestar.c
- *
- * FM - 12.08.92
- *
- * Ausgabe eines Farbverlaufes in der Form eines Sterns.
- */
- #include <exec/types.h>
- #include <proto/exec.h>
- #include <egs/egsintui.h>
- #include <egs/proto/egsintui.h>
- #include <egs/egsgfx.h>
- #include <egs/proto/egsgfx.h>
- #include <egs/egs.h>
- #include <egs/proto/egs.h>
- #include <egs/egsblit.h>
-
- /* die Zeiger auf unsere Libraries */
- struct Library *EGSIntuiBase;
- struct Library *EGSGfxBase;
- struct Library *EGSBase;
-
-
- /* Ausgabe eines regelmäßigen runden Sterns mit 4 Spitzen */
- void drawStar8( EG_RastPortPtr rp, long mx, long my, long h1, long h2 )
- {
- EG_AreaMove ( rp, mx, my-h1 );
- EG_AreaCurve( rp, h2, h1-h2, h2-h1, -h2, mx+h1, my );
- EG_AreaCurve( rp, h2-h1, h2, h2, h2-h1, mx, my+h1 );
- EG_AreaCurve( rp, -h2, h2-h1, h1-h2, h2, mx-h1, my );
- EG_AreaCurve( rp, h1-h2, -h2, -h2, h1-h2, mx, my-h1 );
- EG_AreaEnd( rp );
- }
-
-
- /* und hier passiert etwas */
- #define MAX_SIZE 100
-
- void doThings( EI_WindowPtr window )
- {
- long size;
- struct EB_ClipRect clip;
-
- clip.Next = NULL;
- clip.Left = window->BorderLeft;
- clip.Top = window->BorderTop;
- clip.Right = window->BorderLeft+window->Width-1;
- clip.Bottom = window->BorderTop+window->Height-1;
-
- EG_InstallClipRegion(window->RPort,&clip);
-
- for( size=2*MAX_SIZE; size>1; size-- )
- {
- EG_SetAPen( window->RPort, ((255*size)/MAX_SIZE)*0x1010000 + 0x0000ff00 );
- drawStar8( window->RPort, window->Width/2 + window->BorderLeft,
- window->Height/2 + window->BorderTop ,
- MAX_SIZE,size );
- }
-
- EG_RemoveClipRegion(window->RPort);
-
- WaitPort( window->UserPort );
- }
-
-
- /* das Hauptprogramm */
- void main( int argc, char *argv[] )
- {
- static struct EI_NewWindow newWindow =
- {
- 50,30, 400,300,
- 0,0, 0,0,
- NULL,
- EI_WINDOWCLOSE | EI_WINDOWBACK | EI_WINDOWDRAG,
- NULL,
- "Testfenster",
- EI_SMART_REFRESH,
- EI_iCLOSEWINDOW,
- NULL,
- {0,0,0,0,0,0,0},
- NULL,
- NULL
- };
- EI_WindowPtr window;
-
- /* die Libraries öffnen */
- EGSIntuiBase = OpenLibrary( (UBYTE *)"egsintui.library", 0 );
- if ( EGSIntuiBase )
- {
- EGSGfxBase = OpenLibrary( (UBYTE *)"egsgfx.library", 0 );
- if ( EGSGfxBase )
- {
- EGSBase = OpenLibrary( (UBYTE *)"egs.library", 0 );
- if ( EGSBase )
- {
- window = EI_OpenWindow( &newWindow );
- if ( window )
- {
- doThings( window );
- EI_CloseWindow( window );
- }
- CloseLibrary( EGSBase );
- }
- CloseLibrary( EGSGfxBase );
- }
- CloseLibrary( EGSIntuiBase );
- }
- }
-